import 'package:flutter/material.dart';
import 'package:flutterdemo/model/providermodel/userinfobasic.dart';
import 'package:provider/provider.dart';

class ThemeDataDemo extends StatefulWidget {
  ThemeDataDemo({Key key}) : super(key: key);

  _ThemeDataDemoState createState() => _ThemeDataDemoState();
}

class _ThemeDataDemoState extends State<ThemeDataDemo> {
  @override
  Widget build(BuildContext context) {
    UserInfo provider = Provider.of<UserInfo>(context);
    return Scaffold(
      appBar: AppBar(
        title: Text('data'),
      ),
      body: Container(
        child: Column(
          children: <Widget>[
            Text(
              '朱书坤',
              style: TextStyle(
                // 主题颜色的使用
                color: Colors.red,
                fontSize: 30.0,
              ),
            ),
            Text(
              '朱书坤',
              style: TextStyle(
                fontFamily: 'Maobi',
                // 主题颜色的使用
                color: Colors.red,
                fontSize: 30.0,
              ),
            )
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          print(provider.brightness);
          if (provider.brightness == "light") {
            provider.setbrightness('dark');
          } else {
            provider.setbrightness('light');
          }
        },
        child: new Icon(Icons.add),
      ),
    );
  }
}
